<hr/>
<div class="row-fluid">
    <div class="span12">
        <btn class="btn btn-info" id="btn_back">返回列表</btn>
        <div class="widget-box">
            <div class="widget-title"> <span class="icon"> <i class="icon-pencil"></i> </span>
                <h5>会员信息</h5>
            </div>
            <div class="widget-content nopadding">
                <form class="form-horizontal" method="post" action="${request.contextPath}/system/module/save" name="module_form" id="module_form">
                    <input type="hidden" name="moduleId" value="${module.moduleId}" />
                    <div class="control-group">
                        <label class="control-label">Module Name：</label>
                        <div class="controls">
                            <input type="text" name="moduleName" value="${module.moduleName}">
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label">Module Area：</label>
                        <div class="controls">
                            <input type="text" name="moduleArea" value="${module.moduleArea}">
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label">Module Href：</label>
                        <div class="controls">
                            <input type="text" name="moduleHref" value="${module.moduleHref}">
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label">Parent Module：</label>
                        <div class="controls">
                            <select name="parentModuleId">
                                <option value="">无上级模块</option>
                                <#list parentModuleList as parentModule>
                                    <option value="${parentModule.moduleId}"><#list 1..parentModule.level as i><#if i gt 1>&emsp;&emsp;</#if></#list>${parentModule.moduleName}</option>
                                </#list>
                            </select>
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label">Level：</label>
                        <div class="controls">
                            <input type="text" name="level", value="${module.level}">
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label">Module Icon：</label>
                        <div class="controls">
                            <input type="text" name="moduleIcon" value="${module.moduleIcon}">
                            <!--<span class="help-block blue span8">日/月/年</span>-->
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label">Order Num：</label>
                        <div class="controls">
                            <input type="text" name="orderNum" value="${module.orderNum}">
                        </div>
                    </div>
                    <!--<div class="control-group">-->
                        <!--<label class="control-label">Show Menu：</label>-->
                        <!--<div class="controls">-->
                            <!--<input type="text" name="email" value="${member.email}">-->
                        <!--</div>-->
                    <!--</div>-->
                    <div class="control-group">
                        <label class="control-label"></label>
                        <div class="controls">
                            <input type="submit" value="保存" class="btn btn-success">
                            <input type="reset" value="重置" class="btn btn-danger" >
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
<script src="${request.contextPath}/js/jquery-1.12.2.min.js"></script>
<script src="${request.contextPath}/js/jquery.validate.js"></script>
<script src="${request.contextPath}/js/sweetalert.min.js"></script>
<script type="text/javascript">
    $(function(){

        $("#btn_back").click(function(){
            loadPage("${request.contextPath}/system/module/list");
        })

        $("#module_form").validate({
            submitHandler: function(form){
                $.ajax({
                    url: $(form).attr("action"),
                    type: "post",
                    data: $(form).serialize(),
                    success: function(result){
                        swal({
                            title: "信息提示",
                            text: result.status == "success" ? "恭喜，操作已完成！" : "很遗憾，操作失败了！",
                            type: result.status,
                            animation: "slide-from-top"
                        }, function(){
                            if (result.status == "success"){
                                loadPage("${request.contextPath}/system/module/list");
                            }
                        });
                    }
                });
            },
            rules: {
                moduleName: {
                    "required": true
                }
            },
            errorClass: "help-inline",
            errorElement: "span",
            highlight:function(element, errorClass, validClass) {
                $(element).parents('.control-group').addClass('error');
            },
            unhighlight: function(element, errorClass, validClass) {
                $(element).parents('.control-group').removeClass('error');
                $(element).parents('.control-group').addClass('success');
            }

        });
    })
</script>